#coding=utf8
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext

import datetime
# 小区model
class Xiangmu(models.Model):
 ABC = (
   ('A','A:重要'),
   ('B','B:中等'),
   ('C','C:次要'),
 )
 xiaoquming = models.CharField(ugettext(u'小区名'),max_length=20)
 zhenqu = models.CharField(ugettext(u'镇区'),max_length=20)
 fengongsi = models.CharField(ugettext(u'分公司'),max_length=20)
 xuanzhidanwei = models.CharField(ugettext(u'选址单位'),max_length=20, blank=True)
 hetongzhuangtai = models.CharField(ugettext(u'合同状态'),max_length=20, blank=True)
 zulinjieguo = models.CharField(ugettext(u'租赁结果'),max_length=20, blank=True)
 wuyezhuangtai = models.CharField(ugettext(u'物业状态'),max_length=20, blank=True)
 zujinbiaozhun = models.FloatField(ugettext(u'租金标准'),blank=True, null=True)
 zhongyaoleibie = models.CharField(ugettext(u'重要类别'),max_length=1,choices = ABC, blank=True)
 jingdu = models.CharField(ugettext(u'经度'),max_length=20, blank=True)
 weidu = models.CharField(ugettext(u'纬度'),max_length=20, blank=True)
 xianchanghuanjing = models.TextField(ugettext(u'现场环境'),blank=True)
 xiaoqujianshefangshi = models.CharField(ugettext(u'小区建设方式'),max_length=20, blank=True)
 jifangjianshefangshi = models.TextField(ugettext(u'机房建设方式'),blank=True)
 shiwaitianxian = models.TextField(ugettext(u'室外天线'),blank=True)
 created_date = models.DateTimeField(ugettext(u'创建日期'),default=datetime.datetime.now)
 def __unicode__(self):
   return self.xiaoquming

#修改记录 table:ModifyRecord
class ModifyRecord(models.Model):
 xiangmu_id = models.ForeignKey(Xiangmu)
 origin_record_name = models.CharField(max_length=20)
 origin_record = models.TextField(blank=True)
 update_record = models.TextField()
 update_reason = models.TextField()
 update_date = models.DateTimeField(default=datetime.datetime.now)
 update_user_id = models.ForeignKey(User)
 def __unicode__(self):
   return self.update_record # + ' ' + self.update_date.strftime('%Y-%m-%d %H:%M:%S')

# import datetime 
# class Item(models.Model): 
#  title = models.CharField(max_length=250) 
#  created_date = models.DateTimeField(default=datetime.datetime.now) 
#  completed = models.BooleanField(default=False) 
#  article_list = models.ForeignKey(List) 
#  def __unicode__(self): 
#    return self.title 
#  class Meta: 
#    ordering = ['-created_date', 'title'] 
#  class Admin: 
#    pass
